<template>
	<view class="page">
		<list reqUrl="/api/bonus/pond" ref="listInstance">
			<template v-slot=" { list }">
				<view class="list" v-for="item in list" :key="item.bpId">
					<view class="title">{{item.bonusName}}</view>
					<view class="content">
						<view class="item">
							<view class="label">分红额度(元)</view>
							<view class="num">{{item.bounsAllMoney}}</view>
						</view>
						<view class="item">
							<view class="label">分红人数(人)</view>
							<view class="num">{{item.bounsUserNums}}</view>
						</view>
						<view class="item">
							<view class="label">分红预收入(元)</view>
							<view class="num">{{item.bounsEveryUserMoney }}</view>
						</view>
					</view>
				</view>
			</template>
		</list>
	</view>
</template>

<script setup>
	import { onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
	import { ref } from 'vue';
	import { useGetThemColor } from '@/hooks/useGetThemColor';

	const { primaryColor } = useGetThemColor();

	const listInstance = ref(null);
	// * 下拉刷新事件
	onPullDownRefresh(() => {
		Promise.all([listInstance.value.resetRequest()]).finally(() => {
			uni.stopPullDownRefresh();
		});
	});
	// * 页面触底事件，不能删除，否则不能触发list组件触底事件
	onReachBottom(() => {});
</script>

<style lang="scss" scoped>
	.list {
		padding: 2px 14px 0;
		border-radius: 10px;
		background-color: #fff;

		&+.list {
			margin-top: 10px;
		}

		.title {
			padding: 10px 0;
			font-size: 15px;
			font-weight: bold;
			border-bottom: 1px solid #f5f5f5;
		}

		.content {
			display: flex;
			flex-wrap: wrap;
			padding: 20px 0 0;

			.item {
				margin-bottom: 20px;
				box-sizing: border-box;
				padding-left: 20px;
				width: 50%;
			}

			.label {
				margin-bottom: 10px;
				font-size: 12px;
				color: #717171;
			}

			.num {
				font-weight: bold;
				font-size: 16px;
				color: #D71A34;
			}
		}
	}
</style>
<style>
	/*只能在这里设置*/
	page {
		background-color: #f5f5f5;
	}
</style>